perm filename USEMUS.LCS[UP,DOC]12 blob sn#294193 filedate 1977-07-08 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00011 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00003 00002	**********  Using the Music System -- MUS10  **********
C00021 00003	A type of flow-chart diagram for SIMP would appear as follows:
C00024 00004
C00028 00005	In the next example a unit generator will be added  above  the  right
C00034 00006		Various types of noise  and  other  random  fluctuations  are
C00040 00007
C00049 00008
C00054 00009	********** APPENDIX XXX NOT COMPLETE!!!XXX  ************
C00056 00010	********* SOME INFO RE. THE 'FUNC' PROGRAM ***********
C00059 00011	Information re. WAVES.   To run it type R WAVES.
C00062 ENDMK
C⊗;
**********  Using the Music System -- MUS10  **********

******* WORK IN PROGRESS -- JUNE 76 -- LELAND SMITH *********

This manual is designed for use with the PDP10 at the Stanford AI lab.
It  is  quite  possible  that  several features discussed will not be
operative on other installations.  See appendix for some details.

MUSIC is a complete sound generating  package  which  exists  on  the
disk.  For first attempts type:

	R MUSIC 	
	(All lines must be terminated with the 'RETURN' key.)

At this point the program will type the message:

	INPUT?

Basically  there  are  two responses possible.   If the program is to
receive  further  instructions  from  another  file  which  has  been
prepared with an editing program, type:

	NAME -- where NAME is the name of the file to be read.
			(If NAME has an extension, it must be used!)

If instructions are to be entered by means of the  teletype  keyboard
(TTY mode), type carriage return (<CR>).

At  this  point  a  star  (*)  will appear which means the program is
awaiting input.

(It is possible that an error message  such  as  "Ill  mem.  rel"  or
"Halt"  will  sometimes appear.  If this happens first type 'S' -- to
restart the program -- and then type  in  exactly  whatever  you  had
typed before.  If the error message recurs, find an "expert.")


Most complete statements  to  be  read  by  MUSIC  must  end  with  a
semicolon.  Several  complete  statements  may be entered on a single
line but it is best not to have the lines too long.   More  than  one
line  may  be us@∃HAM←HABAg%]OYJ↓giCi∃[K]h8@A∪L↓iQJA1Kgf[QQC\AMSO\@ xR~∃¬aaKCIfAKm∃esiQ%]NAM=YY←o%]NA←8AiQCPAYS]∀AoSY0AEJA%O]←e∃H\@AUgJ@AQQSf~)M←dA∃]iKe%]NAG=[[K]Qf\~∀4∀@@@$TTTT(@A≥←QJ@Ai!Ch@AQQJAC	←mJAIkYKf↓	≡A≥=(ACaAYrAi<AiQJ↓gs]i¬p~∀∪=LAiQ∀A'π∨I
Aae=OeCZ8~∀~∃¬YeKC⊃r@AaIKgK]P@AS\↓≠+'∪ASfA¬\@ES9giek5K]hD↓W]←o8ACfAM∪≠ A]QSGP↓QCf~)EKK\↓gKhAQ↑AaY¬rABAQKghAQ←]JA=L@Oα≤@Phh@AQtR↓M←d@D↑dAg∃G←]H8~∀~∃%\@A←IIKd@↓i↑@AAYCr@↓iQSfAi←]∀XAMSIghAO∃hAS]Q↑A))dA[←I∀ACfA⊃KgGe%EKH~)CE←m∀XAiQ∃\AisAJt~∀4∀∪!→¬2w'∪5 w
∪9∪'⊂v4∀~∃/!K\Ai!JAG←5akiCQS←\A	KOS]L@E)M(]'≥⊂DAoS1XAEJ↓isaK⊂A←kh8@A)Q%f@A[∃C]f~)iQChAg←k9H@AI¬iB@A%f@AE∃S]N@↓oeSiQK\@A=\@Ai!J@AI%gV@AU]IKdAiQJ↓]C[J4∀E)M(]'≥⊂\D@@↓/QK\↓iQJA
←[akQCiS←8ASfA→S]Sg!KHAi!JAae=OeCZAoSY0Aisa∀~∀E)∃'(Aβ5!_\zH```\λ@A∪[5KISCQKYrA¬MiKd↓iQSf↓iQJA→←YY←]S]NA5KggC≥JAoS1X~∃CAaKCdhA'!∃λ}X@qπ$|X↓∨$@E`D\@AQQSfA5KC]fAs←jAQCm∀@AiQIKJ@A=aiS←9f\~∀qπ$|@↓[KC]L@Ai↑AQShAiQJE%)U%≤DA-Kr\@↓)QSf↓oSYX↓GCkg∀AiQJ↓G←[aUiKH~)g←k]⊂Ai↑AAYCr@!k]YKMfAg←5K←]J↓KYgJ≥fAae=OeCZAQCfA[←[∃]iCed@AG←9ie←X4∃←mKH@AiQ∀@AIKYSGKfAs←j↓]KKH8RAC
PAiS5JAs←TAQSh↓iQJ@	%)+I≤DAW∃rAiQ∀~∃g←U]HAo%YXAa1CrAC≥CS\\4∀~∃)!JAg←U]HAo%YXAE∀AaYCeS]NA¬hA'!∃λ@b8@@A)!JA'!∃	f@↓CmCS1CEYJACeJ@`~∃QQe←k≥P@@j8@@@`↓aYCsL@b↑d↓CfAM¬ghACL@bXA!K]GJ↓C\A←
iCmJ↓Y←oKHv@dAAYCr~)ioSG∀ACfA→CghvfAaY¬sfAM=kdAi%[KfA¬fAMCMhv@@P@AaY¬r@AK%OQh@↓iS[KL@ACf4∃MCgPv@@j↓aYCsLAgSqQKK\AQS[Kf↓CfAM¬gh\@↓∪LAB↓'!⊂A]k[	KdASLAisa∃H@Q	<~∃≥∨PAQShE%)U%≤DA!KeJR↓iQK\E∂≡}λAoSY0AEJA¬aaKCH\Aβh↓iQSf↓a←S]P@AisAJ~∃C9r@A←QQKdA
QCeC
iKd@!←iQKHAiQC8@yπ$xA←dA`RAi↑↓QKCd↓iQJAM←k]H8A∪LAe←j~∃QsaJ@	0DAi!JAae=OeCZ↓oSYX↓KqSh↓Me←Z↓iQJ@	aYCrλA[←I∀@AC]⊂@AeKQke\@↓iQJ~)gs[E=X@DTλXAoQ%GPA[∃C]fA%hASf↓oCSi%]NAM=dAg←5JA]K\AG←[5C]H\A/QK8@E0D4∃SfAQsaKH0As←j↓oSYX↓OKhAQQJA[∃ggCO∀@@E!1β'
↓	→Q
A)M(]'≥⊂\D@@A)QSL~∃[K¬]f@AQQCh@↓oQK\↓s←jA!CmJA→S]Sg!KHAs=kdAo=eVAs=jAgQ=kYHAQsaJ@qπβ→_xX~∃i!K\@E⊃_A)∃'(]'9λ@yπH|@Ag<@AiQ∀AgaC
JA←\↓iQJA⊃SgVAQCWK\Ak`@↓Er@Ae←kd~)g←k]⊂AiKgQfA[CdAEJAIKGYC%[KH\4∀~∃∪_@As←TAQCm∀Aisa∃HAC\E0DA	khAo%gPAi<AeKiUe\Ai<@EaY¬rDA[=IJXAQsaJ@⊃ v~∃]QKeJNHNA%]ISG¬iKfAQQJ@O¬→(NA-Kr\~(~∀~∀(TTTT(TTTT(TTTT(TTTT(TTTT(TTTT(TTTT(TTTT(TTTT(TTTT(TTT~(~∃)Q∀AS]gQek[K9hA'∪5 AQCLAMSm∀AaCe¬[KiKIf\~∀4∀∪ bzAEK≥S\Ai%[JA←_A]←i∀@QS\↓gKG←9IfR~(∪ d@tAIke¬iS←\↓←LA]=iJ@@@@D@@@@D4∀∪ fzAaSQGP~∀% h@z↓C[aY%ikIJ4∀∪ jzAoCYJAM←IZ@Q←HAiS[	eJR~(~∃ b↓C]HA@dAoS1XAQCYJAiQ∀AgC[∀AgSO9SMSG¬]GJA%\ACY0AS]gQek[K9ifAEUh@AC1X~∃Q%OQKd@A]k5EKeK⊂@@Aa¬eC[KQKef@ACeJACgg%O]KH@Ae←1Kf@A¬GG←e⊃S]N@↓i↑~∃
←]mK9SK]G∀\@@Q!←oKm∃dASh↓oSYX↓ae←m∀AkgK→kXAi<AG←]MSgiK9iYrA¬aaYrA f~)C]HA@hACf↓CE←m∀\R~∀4∃∪]i∃e]CY1rACY0AaSi
PAK]QeSKf↓EKG←5J@A]U[KeS
CXX@↓Q←oKYKd@AQQJ@AQoKYm∀~∃Me∃ckK]
SKf@↓←L@AQQJ@AQK[aKIKHAG!e←[CQSFAg
CYJX↓Me←Z↓[SII1JAε@ dlb\Xd~∃QhRAk`↓i↑A∧↓[CrA	JAkg∃HAS\↓≠+'∪AErAQsaS]≤AiQJ↓YKii∃d@A]¬[Kf@↓←L@AQQJ~∃9←iKf8A)QJ↓YKii∃dA&@t@FXA_@zAM1Ch\~(~∃'S9GJ@AQQKgJAYKiQKef@↓[KeK1rAeKAeKgK9hAiQ∀AMeKEkK]G%KfA←_AKCG A]←i∀X~∃i!JA←GQCmJAIC]OJA[CrAEJ@↓GQC]≥KH@A	r@A[UYiSa1sS]NA←d@↓ISmS⊃S]N@↓Er~∃5kYiSAYKfA=LAio<\@@AQQkfAA←dA∧AS\AQQJA←
iCmJ↓EKY←\A[SI⊃YJAε↓o←kY⊂AEJ~)K]iKIKHACLAε↑d↓←dAα<d\@@↓∪\Ai!JA←GQCmJA¬E←mJ↓iQJA	CgSF↓[SII1J@A←
iCmJ4∃iQKMJA]←QKfAo=kYHA	JAεTHA←dA∧Td\~(~∀∪εZZ@d↓←GiCYKfAI=o\Ao=kYHA	JAε↑P~∀∪εZZ@f↓←GiCYKfAI=o\Ao=kYHA	JAε↑`~∀∪εZZ@d↓←GiCYKfAk@Ao←k1HAEJ↓εTh~(∪ε@Z4@fA←
iCmKLAk`A]←kYH↓EJAε(pAKi\~∀~))↑Ai∃ghAi!JAkg∀A←LAQQKgJ↓YKii∃efAiIrt~∀4∀∪ g⎇εw!→¬2w'∪5 w
∪9∪'⊂v4∀~∃≥=nAS]Miek[∃]hA'%≠ Ao%YXAG=[aki∀A[SI⊃YJAε↓S]gi∃CHA←_@Aα\@@A)!J@AY∃Mh~∃¬ee←n@Q>RAS]I%GCiKL@AiQ¬h@Ai!J@Am¬YkJ@↓←L@AAQCf↓EKK\↓aYCG∃HAS\↓ fX~)eKaY¬GS]N↓C]rAYCYkJ↓iQCh↓oCfAAeKmS=kgYr↓iQKe∀\@@QQQJAY∃Mh@A¬ee←nAC]H4∃iQJ↓KckC1fAgS≥]6{:↓CeJA%]iKe
QC]O∃CEYJ↓S\Ai!SfAaI←OeC4\R~∀4∃!→βdw'∪≠@w
∪≥%'⊂v@↓[kghAEJAQsaKH↓g↑Ai!JA]K\A]←i∀AoSY0AEJA
←[akQKH\~)βMiKHAShA%fAMSIghAQ∃CeHA%hA[CdAEJAIKaKCQKHACLAS]I%GCiK⊂ACE←YJ\~∀4∃∪LA→eKck∃]GSKLA←iQ∃dAiQ¬\AiQ=gJA←_@AiQ∀@AiK5aKeK⊂@AgG¬YJ@A¬eJ@AQ↑@AE∀~∃aY¬sKHX↓BA]k5EKdA5CrAE∀AkgK⊂AS]gQKCHA=LABA1KiiKH\~∀~(∪ g>D```wA→β2wM∪≠ w→∪≥∪' vAoS1XAaY¬rABAQ←]JA¬h@b`@`AQt8~∀~∀4∃)QJ↓C[aY%ikIJ↓gGCY∀ACmC%YCEY∀ASfAQQJAe¬]OJA=LA]k5EKdA→e←Z@@Ai↑@d`hn8~∀Q)!Sf@AUaaKdAYS[%h@ASL@AgKP@AEr↓iQJA9k[EKHA←LA	SifAlbe:AUgKHA→←dAi!J~∃g=k]HAMC[aY∃f\@AMKJACAaK]I%p\RA@hAQCLAEKK8AgKh↓Ch@d@``AM=d@Ai!J@Ai∃gh~∃Q←]J\A)QSLA[Cr↓EJAe∃gKhAUgS]N↓iQJAMC[JA5KiQ←⊂ACfA⊃KgGe%EKHA	KM←e∀\~∀~(∪ i>D``w M?∂&THw!→βdw'∪≠@w
∪≥%'⊂v~(~∃)Q%fAoS1XAaY¬rABA≤FACE=mJAi!JA[S⊃IYJA=GiCm∀AChA¬[aYSQkIJ@D``\~(~∃)Q∀AIke¬iS←\↓←LAi!JAi←9JA[CdAEJA
QC]O∃HAEJ↓eKgKQiS]N↓ d\~(~∀∪ I>\bv↓KiF\↓oSYX↓aYCr↓BA]←QJA←Lb↑b`↓gKF\↓IkeCQS←\\4∀~∃∪8AOK]∃eCXX↓iKgh↓i←]KLAgQ←UYHAe¬eKYr↓KqGK∃H@bD↓IkeCQS←\\4∀~∃/!K\Ag∃mKeC0AaCe¬[KiKIfACe∀Ai↑@↓EJ@A
QC]O∃H@ACP@A←]
J@Ai!J@AM=YY←o%]N~∃QsaJ[%\AM←I[ChAMQ←kY⊂AEJAUgKHt4∀~∀∪A→β2wM∪≠ @@@\dA→&↑d@`j`w
%≥∪'⊂l~∀~∃QQSfA]SYXAAYCrA_FAEK1←nA[%IIYJ↓εAM←H@d↑b@DACh↓C\@A¬[aYSQkIJ@↓←L@@`j`\~(Q!YK¬gJ@A9←iJ@↓iQChA jXAiQJAoCm∀AM←e4AM←d↓'∪≠ 0AoSY0AEJA⊃KCYh↓oSiP4∃YCi∃d\R~(~∀TT(TTTT(TT@A
∨≠≠βL@@TT(TTTT(TT~∀4∃π←[5CfA[¬rAEJ↓kgKH↓i↑Ag∃aCeCQJAiQ∀AaCemeters and if nothing precedes
a  comma  the contents of that parameter remains unchanged.  Also any
parameter numbers higher than the length of  the  list  will  not  be
affected.

	PLAY;SIMP ,.3,,1200;FINISH;  changes only P2 and P4.

******************************************************

A string of notes may be played with the following input:

	PLAY;SIMP 0 .2 C 1500;SIMP .2,,D;SIMP .4,,E;
	 SIMP .6,,C;FINISH;

In this case P1 must be updated for  each  note.  (Never  overlap  an
instrument  with  itself.   Distortion  will  occur.)  P2,  the  note
duration remains unchanged, so the commas suffice for the last  three
notes.  P4, coming at the end of the list for  the  first  note  need
only be stated once if it is not to change.

Rests  are created by simply leaving some time between the end of one
note (P1+P2) and the beginning of the next (the new P1).

	PLAY;SIMP 0 .2 C;SIMP .5;FINISH; will play C  for  2/10",
rest for 3/10" and then play another C for 2/10".


**********  FUNCTIONS  **********

The  wave  form  in P5 is entered by means of a name which is used by
the program to locate a  list,  or  array,  of  numbers  (512)  which
describe  the wave.  The names used for this purpose will always be F
followed  directly  by  a  number.    These  arrays  will  be  called
"functions."

Only  one  function  is  in  MUSIC,  although more can be added.  The
function present is known as F3 and describes a sine  wave.   To  see
this wave on the CRT type:

	SEE(F3);

To clear the screen hit the 'ESC' key followed by  a  'C'.  (This  is
called ESCAPE C.)   <CR> will bring back the typescript display if it
is gone.

Functions may be created with an  external  program  called  FUNC  or
within  MUSIC  itself  by means of two routines called SYNTH and SEG.
SYNTH is used to create composites made by adding  various  harmonics
together.  The form of F3 could be changed in the following manner:

	SYNTH(F3); 1,1  2,1  3,.5  999;

In the three pairs of numbers, the first of each pair represents  the
harmonic  number  and  the  second  the  relative  amplitude  of that
harmonic.   Thus the ratios of harmonics 1, 2 and 3 will be 1:1:.5 .

The size of the second number of each pair is important only  in  its
relation to the other amplitude numbers.  The last  number,  999,  is
used to signal the termination of a string of entries.

Several pairs may entered and harmonic numbers up to 256 may be  used
but  in  practice  great  care  must be taken to avoid the "foldover"
effect which  occurs  when  frequencies  higher  than  one  half  the
sampling rate are present. (See appendix.)

It should be pointed out that the fundamental (harmonic #1) need  not
be present in a wave.

	SYNTH(F3); 10,1  12,1  15,1  999; will give  the  three notes
of a minor chord.  After this has been  entered  the  following  will
cause a C minor chord to play:

	PLAY;SIMP 0 .5 GS/8;FINISH;

While the lowest Ab (or G#) on the piano keyboard has been indicated,
since  the wave form includes only the 10th, 12th and 16th harmonics,
the notes middle C, Eb and G will be heard.

Several  experiments  with  different  wave forms should be made.  Be
sure to SEE the waves so a visual-aural connection might be made.

A function may be changed in the middle of a PLAY routine but it must
be  noted that the new wave definition must follow! the note which it
is to affect.

	In PLAY;SIMP 0 .3 D 1000; SIMP .3; SYNTH(F1); 1,.7  3,.2
	    5,.1  999; SIMP .6,,E; FINISH;  the newly defined wave
     	will be heard in the second and third notes.


If you wish to have several functions with different names  available
and you do not create them with the FUNC program, their names must be
"declared" to MUSIC.  Suppose you wish to have F1, F2  and  F4.   You
must type directly to MUSIC (or into an  EDIT file which will be read
by MUSIC) the following:

   ARRAY F1,F2,F4(512);

The "(512)" indicates that each function array will require 512 words
of storage. 

The following example will play a sequence of notes wherein are heard
the 10th, 14th and 18th harmonics of a low C, then the 10th, 13th and
16th, and finally the 10th, 12th and 14th harmonics.
	As  each  SYNTH  function  is  typed  in  the  wave  will  be
displayed (at some terminals.) If you wish a clear screen  after  the
last  one has appeared, hit the 'ESC' key followed by a 'C'. (This is
called ESCAPE C.)

	ARRAY F1,F2(512);
	SYNTH(F1);10,1 14,1 18,1 999;
	SYNTH(F2);10,1 13,1 16,1 999;
	SYNTH(F3);10,1 12,1 14,1 999;
	PLAY;SIMP 0 .3 C/4 2000 F1;
	SIMP .3,,,,F2;SIMP .6,,,,F3;FINISH;



	From this point on it would probably be better to prepare any
input  for MUSIC which requires more than a couple of lines of typing
with the SOS or ETV editors.  Typographical errors are inevitable and
when an error is made near the beginning of a string of  input  typed
directly to MUSIC you most likely will have to retype everything.
A type of flow-chart diagram for SIMP would appear as follows:

		 P4       MAG*P3
		  |         |
		  ↓         ↓
		***************
		*             *    OSCIL
		*             *    U1 (UNIT GENERATOR ONE)
	        *     P5      *
	         *           *
		  *         *
		   *********
		       |
		       ↓
		     *****
		    * OUT *
		    *  A  *
		     *****

The top left input, P4, serves simply as a multiplier for the numbers
found  in  the  wave  form array, P5.  The particular number from the
array to be multiplied is determined by the number in the upper right
input.   The  upper  right  input, in this case P3, when processed by
"MAG" (the "magic" number) becomes the increment, the rate  at  which
the  wave form array is stepped through.  The "magic" number is found
by dividing the array length, 512, by the sampling rate,  12800  (for
SPEED 1.)

   512/SRATE=.04 (Higher sampling rates will be discussed later.)

The  maximum  size of the numbers in the wave array is + or -1.  Thus
if P4 is set to 1000 the output of the OSCIL will be numbers  in  the
range  +1000  to  -1000 which will describe the wave form put into P5
cycling at the rate given in P3.


The code for entering this instrument follows:

	INSTRUMENT SIMP;
	OSCIL(P4,MAG*P3,P5);
	OUTA←OUTA+U1;
	END;

This  instrument  has  only  one unit generator (the OSCIL) hence the
output of U1 is added to the contents of OUTA.  If there are  several
instruments  the  outputs  of all the instruments will be combined in
OUTA for each sample.

It will be noticed when playing instrument SIMP that the sound begins
and ends quite abruptly.  This is because  no  attack-decay  envelope
has been applied to the tone.  The sound begins at the full amplitude
of P4 and remains at that level for  its  total  duration.

To apply an envelope, another unit generator must be added.


		 P4       MAG/P2
		  |         |
		  ↓         ↓
		***************
		*             *    OSCIL
		*             *    U1 (UNIT GENERATOR ONE)
	        *     P5      *
	         *           *
		  *         *
		   *********
		       |
		       | 	 MAG*P3
		       |         |
		       ↓         ↓
		     ***************
		     *             *    OSCIL
		     *             *    U2 (UNIT GENERATOR TWO)
	             *     P6      *
	              *           *
		       *         *
		        *********  		INSTRUMENT TOOT;
		            |			OSCIL(P4,MAG/P2,P5);
		            ↓			OSCIL(U1,MAG*P3,P6);
		          *****			OUTA←OUTA+U2;
		         * OUT *		END;
		         *  A  *
		          *****

To create  this  instrument the definition listed above must be typed
in.  Now that the instrument has been expanded you will note that  it
is the output of unit generator two (U2) which goes to OUTA.

P5 will now contain the envelope array.   This array is best  defined
by the SEG routine.   SEG defines the positions of line segments used
to approximate a curve.   With SEG several pairs of  numbers  may  be
entered.   The first number of each pair is an amplitude, normally in
the  range of 0 to 1, and the second is the step number in the array.
The step numbers 1 through 100 are used in SEG.   (However  the  step
numbers are  converted  internally to 512 array locations.)  Straight
line segments are drawn between each of the  points  defined.     The
following would put a triangular envelope shape into F1:

	ARRAY F1(512);
	SEG(F1); 0,1  1,50  0,100;

    Note that the routine is terminated when step 100 is reached.
    DO NOT USE 999 with SEG.

After having typed in the code for instrument TOOT and the definition
for an  envelope in F1,  the following will produce a note using that
envelope:

	SYNTH(F3);1,1  2,.4   3,.1 999;< Sets the tone color.
	PLAY;TOOT 0 .5 A 2000 F1 F3;FINISH;

If two envelopes are to be contrasted add another function and define
it.
	ARRAY F2(512);
	SEG(F2); 0,1  1,7  .2,25  .1,60  0,100;< Staccato
	PLAY;TOOT 0 .2 1000 2000 F2 F3;  < P5 has envelope
	TOOT .2 .5,,,F1;FINISH;<Plays stac. then sust.(F1 then F2)

In the next example a unit generator will be added  above  the  right
side  of  the  bottom,  tone producing unit generator.  In this way a
function may be used to describe fluctuations  of  pitch  within  the
duration  of  a  note  --  much  as  the  previous  example  gave the
possibility for changing the amplitude during a single note.


				 MAG*P7-MAG*P3       MAG/P8
	 P4       MAG/P2		   |         |
	  |         |			   ↓         ↓
	  ↓         ↓			 *************** 
	***************			 *	       *   OSCIL
	*	      *	 OSCIL		 * 	       *   U2
	*             *  U1     	 *     P9      *
	*     P5      *      		  *           * 
         *           * 			   *	     * 
          *         * 			    *********
	   ********* 	   MAG*P3		|
	       |	       |   _____________|
	       |________      _↓___↓_
		       |      \     /
		       |       \ + /
		       |        \_/
		       |         |
		       ↓         ↓
		     ***************
		     *		   *
	     OSCIL   *             *
	     U3	     *     P6      *
	              *           * 
		       *         *
		        *********     INSTRUMENT GLISS;
		            |	      OSCIL(P4,MAG/P2,P5);
		            ↓	      OSCIL(MAG*P7-MAG*P3,MAG/P8,P9);
		          *****	      OSCIL(U1,MAG*P3+U2,P6);
		         * OUT *      OUTA←OUTA+U3; END;
		         *  A  *
		          *****


In order for this instrument to perform glissandos, a third  function
must  be  defined  for P9 (the "shape" of the glissando).  A straight
line slope will suffice for a simple glissando.  After typing in  the
instrument definition set up the three functions.

	ARRAY F5,F6(512); <F3 is already present.
	SEG(F5);0,1  .8,7  1,12  1,90  0,100;<Envelope
	SEG(F6);0,1  1,100; <Slope

In the preceding, the ARRAY declaration is needed only when some  new
function names are to be used.

The following will play a glissando up two octaves, from C to C*4.

	PLAY; GLISS 0 1 C 2000 F5  F3 C*4 1 F6; FINISH;

If P8←.5; (while P2 remains at 1) two glissandos will be heard.



This  instrument  may  be  used  for  a  dramatic  demonstration   of
"foldover", the phenomenon  which occurs when a frequency exceeds the
upper limit of one half the sampling rate.  (See Mathews' book for  a
technical explanation.)

For this purpose it is best to use a Sine wave in P6.

	SYNTH(F3); 1 1  999;

	PLAY; GLISS 0 1 1000 2000 F5 F3 4000 1 F6;FINISH;

This first note will slide up from 1000 hz to 4000 hz.


	PLAY; GLISS 0 1 1000 2000 F5 F3 11800 1 F6;FINISH;

Due to "foldover" (at 12800/2 hz.) this note will slide up to 6400 hz
and return to the 1000 hz level even though 11800 hz was given in P7.
The  general rule for "foldover" is that any frequencies which exceed
one half the sampling rate will be heard at (SRATE-F) hz.


Try this one!

	PLAY; GLISS 0 1 0 2000 F5 F3 30000 1 F6; FINISH;


This same instrument may be used to produce a vibrato  by  putting  a
sine  wave into P9, setting P8←1/7; (the vibrato rate will be 7 times
per second) and making P7 some very small amount different from P3.

	PLAY; GLISS 0 1 C 2000 F5  F3 C+2 1/7 F1; FINISH;

		(It is assumed that F1 is a sine wave.)
	Various types of noise  and  other  random  fluctuations  are
produced  by the two random number unit generators.  These are called
RANDH and RANDI.  RANDH (H=hold) produces in effect a  function  made
up  of  horizantal  lines at various levels with a perpendicular jump
from one level to the next.  There are  two  inputs  to  RANDH.   The
first   (left  hand)  gives  the  range,  plus  or  minus,  of random
selection and the second (right hand) gives the rate (per  second) at
which the selections are to be made.

	Care  must  be  taken with the number in the first input.  If
the number 100 is given, the output of RANDH will  fluctuate  between
+100  and  -100.  Thus if a range of 100 to 200 is desired, the input
number should be 50 and the number 150 must be added to the output.


				        MAG*P7     MAG*P8
	 P4       MAG/P2	           |         | 
	  |         |		           ↓         ↓
	  ↓         ↓			 *************** 
	***************			 *	       *   
	*	      *	 OSCIL		 *    RANDH    *   U2
	*             *  U1     	 ***************
	*     P5      *      		        |
         *           * 			        |
          *         * 			        | 
	   ********* 	   MAG*P3		|
	       |	       |   _____________|
	       |________      _↓___↓_
		       |      \     /
		       |       \ + /
		       |        \_/
		       |         |
		       ↓         ↓
		     ***************
		     *		   *
	     OSCIL   *             *
	     U3	     *     P6      *
	              *           * 
		       *         *     
		        *********     INSTRUMENT NOISE;
		            |	      OSCIL(P4,MAG/P2,P5);
		            ↓	      RANDH(MAG*P7,MAG*P8);
		          *****	      OSCIL(U1,MAG*P3+U2,P6);
		         * OUT *      OUTA←OUTA+U3; END;
		         *  A  *
		          *****

			ARRAY F2(512); <F3 is already present.
			SEG(F2);0,1  .8,7  1,12  1,90  0,100;<Env.




	The following will produce white noise.

	SRATE←25600;MAG←512/SRATE;
	PLAY;NOISE 0 .5 C*8 1000 F2 F3 P3 P3*4;FINISH;

	Actually  P8 (given as P3*4) can probably be left at a number
like 4000 for  noise  purposes.    As  P7  iq  changed  the  apparent
band-width  of  the  noise  will  be changed.  As the band-width gets
narrower the center frequency becomes more apparent. Thus if P7←P3/16
and  P3 is up in the range of C*8, something of the effect of blowing
across an open tube will be produced.  The  pitch  is  clear  --  but
quite windy.

	The  SRATE  (sampling  rate)  must  be  increased  for  noise
production since very high frequencies are essential.  At SRATE←25000
the high frequency cut-off will be at 12800 hz.

	If P8 is set to a  low  number  (e.g.  8)  individual  random
pitches, instead of noise, will be produced at that rate.


	If the random unit generator  is  replaced  by  a  RANDI  the
random  function  produced  will  be  made  up  of a series of slopes
(I=interpolating) up and down from one random point to  another.   In
the case of noise production there is little difference between RANDI
and RANDH.  However RANDI is necessary for  getting  such  things  as
random  vibrato.    The following will produce an acceptable, "human"
sounding vibrato.

	PLAY; NOISE 0 1 C*2 1000 F2  F3 P3*.01 16; FINISH;

	The random rate of 16 per  second  (in  P8)  is  considerably
faster  than  the  human  vibrato rate of 5 to 8 per second.  In this
case however since  the  full  band-width  (in  P7)  is  only  seldom
attained and the heard effect is that of a rate much slower than 16.



With an ordinary OSCIL there is no simple way to  have  a  long  note
keep  the  same  characteristics of attack and decay as a short note.
The LINEN unit generator is used to create  envelopes  with  separate
controls over attack time, decay time and steady state.


	  	  P7   P8   P9
	 	  |    |    |
	P4	  ↓    ↓    ↓        VAR
	| 	***************       | 
	|      *               *      |     LINEN	
	|     *                 *     |   U1 (UNIT GENERATOR ONE)
	---→ *        P5         * ←---
	    *                     * 
	   *                       *  
	  ***************************
		       |
		       | 	 MAG*P3
		       |         |
		       ↓         ↓
		     ***************
		     *             *    COSCIL
		     *             *    U2 (UNIT GENERATOR TWO)
	             *     P6      *
	              *           *       VARIABLE /VAR;
		       *         *	  
		        *********  	  INSTRUMENT LIN;
		            |		  LINEN(P4,P7,P8,P9,P5,VAR);
		            ↓		  COSCIL(U1,MAG*P3,P6);
		          *****		  OUTA←OUTA+U2;
		         * OUT *	  END;
		         *  A  * 	  
		          *****



The parameter arrangement for LINEN is rather different from that for
OSCIL.  The far left parameter (P4) is, as usual, an amplitude input.
The next three (P7, P8  and  P9  in  this  particular  example)  will
receive  the  attack  duration,  the  decay  duration  and  the total
duration of the envelope, in  that  order.   The  next  item  in  the
parameter  list  (P5 here) will contain the envelope array name.  The
last item is a "run-time" variable which is  needed  to  ensure  that
each note uses the correct portion of the overall envelope.

The internal workings of LINEN make it unnecessary to use "MAG"  with
the  3  time  domain  parameters.   The  proper conversion of time to
increments is automatic.  The 3rd parameter (P9) of this group  could
have  been  P2.  However since P2 is always a special parameter which
tells how long the instrument is to be turned, its  use  to  indicate
the  total  duration of the envelope would make it impossible to play
several notes within one envelope cycle (a phrase.)

The array used for LINEN must be defined in a special way.  Only  the
first 2/3 of the available locations are to be used.  When using SEG,
steps 1-25 are reserved for the attack portion, steps 26-50  for  the
"steady  state"  and steps 51-75 for the decay portion.  Steps 76-100
are ignored by LINEN but must be included in the SEG input  in  order
for  the SEG routine to conclude properly.  To test the properties of
LINEN it is best to construct an envelope with dramatic changes.

	ARRAY F2(512);
	SEG(F2); 0,1  1,2  .3,25  1,50  0,75  0,100;

If parameters 7, 8 and 9 are set properly, this  array  will  give  a
sharp  attack  followed  by  a  return to a low amplitude (.3) at the
start of the "steady state"  section.   Following  there  will  be  a
relatively  slow  crescendo to full amplitude and then a rapid decay.
It must be emphasized that the sum of the values given for P7 and  P8
(attack  and  decay)  must  never  exceed  the  value  of  P9  (total
duration.) Likewise, P9 should never be less than P2, (the total time
the instrument is turned on for a single note.) To visualize the true
shape of the envelope for any particular note duration (ND)  consider
that  the  time  spent in the middle section of the array (SS="steady
state" area) will be what is left when the attack (AT) and decay (DK)
are subtracted from the total duration (TD.)

	SS = TD - AT - DK

To play the following notes add about 5k to your core image.

	PLAY; LIN 0 1 A 2000 F2 F3 .08 .08 1; VAR=0; FINISH;


The special  variable  VAR  is  used  to  reset  a  pointer  for  the
initialization  of  the envelope.  When a variable is declared with a
preceding slash ( /VAR ) it is known as a "run-time" variable.   This
means   that,  unlike  ordinary  parameters  which  are  read  by  an
instrument only at the  beginning  of  a  note  (at  input  time,  or
"I-time"),  a  "run-time"  variable  is  read or changed every time a
sample is computed.  A unique variable must be used  for  each  LINEN
unit  generator.    The  variable must be set to 0 immediately after!
each detached note or after the first note of a phrase.

In  the  following,  the 2 notes D, F will be connected (phrased) and
the 3rd note, C#, will be detached.   Notice  that  the  first  value
given  in  P9  (total  duration  of  envelope)  represents  the total
duration of the first 2 notes.  P9 is changed to  equal  P2  for  the
separate note.

	PLAY; LIN 0 .5 D 2000 F2 F3 .08 .08 1; VAR=0;
	LIN .5 .5 F;    < P4 to P9 remain the same.
	LIN  1 .5 CS 2000 F2 F3 .08 .08 .5; VAR=0;
	FINISH;



You will have noticed that the last unit generator in this instrument
is called a COSCIL.  This is exactly like an OSCIL  except  that  the
pointer  to  the array is never re-initialized.  This allows the wave
form produced to be continuous from one note to the next.   (The  "C"
indicates it is a "continuing" OSCIL).  If an OSCIL were used in this
situation clicks would often be heard between phrased notes.

	Frequency modulation allows for  the  production  of  a  wide
variety  of  tone  colors  using relatively little compute time.  The
INTRP unit generator is really just a  combination of an OSCIL and an
ADD box.  The left input represents the output when the function (P10
below) is at zero and the right input represents the output when  the
function  is  at  1  (peak  amplitude).   No time input is given with
INTRP.  The speed of stepping through the function  array  is  always
taken  as  being  P2,  i.e. the note duration.  In this case P10 will
contain an envelope which  will  control  the  changes  in  frequency
modulation.   For  a  full  explanation of FM see John Chowning's AES
Journal article on this subject.


				 P9*P7*MAG    P8*P9*MAG
				      |         |
				      ↓         ↓
				    ***************
				     *           *
				      *   P10   *   INTRP
				       *       *    U2
					*     *
					 *   *
					  * *
				           *         P9*MAG
	 P4       MAG/P2		   |         |
	  |         |			   ↓         ↓
	  ↓         ↓			 *************** 
	***************			 *	       *   OSCIL
	*	      *	 OSCIL		 * 	       *   U3
	*             *  U1     	 *     P11     *
	*     P5      *      		  *           * 
         *           * 			   *	     * 
          *         * 			    *********
	   ********* 	   MAG*P3		|
	       |	       |   _____________|
	       |________      _↓___↓_
		       |      \     /
		       |       \ + /
		       |        \_/
		       |         |
		       ↓         ↓
		     ***************
		     *		   *
	     OSCIL   *             *
	     U4	     *     P6      *
	              *           * 
		       *         *     
		        *********     INSTRUMENT FM;
		            |	      OSCIL(P4,MAG/P2,P5);
		            ↓	      INTRP(P7*P9*MAG,P8*P9*MAG,P10);
		          *****	      OSCIL(U2,P9*MAG,P11);
		         * OUT *      OSCIL(U1,U3+P3*MAG,P6);    
		         *  A  *      OUTA←OUTA+U4; END; 
		          *****



    The following functions should be set up to test the FM instrument.

	ARRAY F1,F2,F3(512);
	SYNTH(F1); 1 1 999;   < A sine wave.
	SEG(F2);0,1  .9,4  1,8  1,72  .8,88  .5,95  0,100; < Envelope
	SEG(F3); 0,1  1,100;  < An upward slope or ramp.

	The following will produce a shift from a pure sine tone to a
highly modulated tone over a period of 2 seconds.

	PLAY; FM 0 2 100 1000 F2   F1 0 10 100 F3  F1; FINISH;


	To reverse the procedure, i.e. change from the modulated tone
to the pure tone, reverse the values of P7 and P8.

	P7←10; P8←0; PLAY;FM;FINISH;


	Change F3 (the ramp) to make the modulation  emerge  only  in
the mid-part of the note.

	SEG(F3); 0,1  1,50  0,100;  < Makes a pyramid.

	PLAY;FM;FINISH;

	Try several of the variations suggested in Chowning's article.
********** APPENDIX XXX NOT COMPLETE!!!XXX  ************

The main program for sound generation is currently  called  MUSIC.FAI
or some  similar  name.      The export version is designed to run on
a standard PDP10 DEC system (which has a "FAIL" compiler.)

The main program must be loaded with two  subroutine  packages  which
are  called MUSF4.F4 (OR MUSEXP.F4) and MUSIO.FAI (or EXPIO.FAI.) The
FORTRAN routines are for the creation  of  function  arrays  and  for
organizing  the  output  of  sound samples to tape or disk after they
have been computed.  The FAIL routines are for fast output of  blocks
of samples.

See SCORE.LCS[UP,DOC] for information on longplaying features (RCDFLG
and BIGBIT) and much other information.




************ LOCAL SPEAKERS ***********


	To hear all sounds produced by the  D-A  converter  from  the
small  speaker  associated  with  your  TTY console hit the 'ESC' key
followed by the '3', and then the 'U'. (ESCAPE 3 U).
********* SOME INFO RE. THE 'FUNC' PROGRAM ***********

CRUNCH:  Any two functions already in  a  single  .DAT  file  may  be
"crunched" together.  Also, a function may be created by  either  the
SEG  or  SYNTH  routines and then if instead of typing "F" for FINISH
the letter "Z" is typed the program will jump immediately to "crunch"
mode.   At  this  point  the  new  function  may be combined with any
function found in the file presently in core.  Note however that once
this new function  is  processed  by  any  of  "crunch"  options  its
original  form  cannot be regained without going back to ordinary SEG
or SYNTH mode.

PLOTTING:  If "SP" (=see on the plotter) is  typed  single  functions
can  be  drawn  on  the  Calcomp  plotter.   The size asked for is in
inches. "SA" (=see all on plotter) will plot all the functions  found
in  a single file. 
"SX"  (=see all on the XGP)  will draw all functions  from  a  single  
file  in  the  proper  size for printing by the XGP.  In order to use 
"SX" you must!!! follow the next steps exactly!!!

	Before running FUNC type: A DSK PLT <CR>. This will cause the
	instructions FUNC sends to the plotter to  be  written  in  a
	file on the disk.

	When  the  FUNC  program  finishes  then  type  R X <CR>.
	This runs a  program  called  X  which  converts  plotter 
	information to XGP commands.

	X will ask you 5 questions.  You should answer as follows:

		PLOT.BIN <CR>		(the file name)
		<CR>			(plot slice?)
		5  <CR>			(shift 5 inches)
		<CR>			(use default value of 11".)
		1  <CR>			(1 inch from the left)
		Y			(yes, delete the plot file)



Information re. WAVES.   To run it type R WAVES.

This  will  allow  you  to  display  the  actual wave shapes of sound
computed by MUS10. The TEST.SND file thus produced is read by WAVES.

You may display up to 3072 samples at a  time  but  since  only  1024
separate  positions  can be shown at once, larger  numbers will cause
some samples to be skipped over (but with no great loss.) After  each
group  of samples is displayed a <CR> will move on to the next group.
If a number is typed, that will set the extent of the next group.  If
the number -1 is given, the program will automatically cycle  through
all available samples by groups of the last given number.   (When  no
more samples  are to be found it will end with an error message.)  In
order to make the program  go  backwards  type  any number less  than
-2 for the number of samples you wish to back up.

This  program  should be of use in seeing the wave shapes produced by
amplitude and frequency modulation as well as seeing the  effects  of
foldover,  etc.   Composite  waves  from  more  than one voice may be
displayed but  as  the  complexity  increases  it  may  prove  rather
difficult to glean useful information from what is seen.

(When  WAVES  asks  "TYPE  FILE  NAME",  a  simple  <CR>  will be the
equivalent of typing TEST.SND <CR> .)